<?php defined('APP_PATH') or exit('Access Denied');?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>会员列表</title>
<link rel="stylesheet" type="text/css" href="vonuo/static/css/vonuo.css">
<script type="text/javascript" src="vonuo/static/js/jquery.min.js"></script>
<script type="text/javascript" src="vonuo/static/js/tablecolor.js"></script>
<script type="text/javascript">
function updst(){
	var i = 0;
	$("input[name='id[]']").each(function(){
		if($(this).attr('checked')){
			i++;
		}
	});
	if(i == 0){
		alert('请选择要切换状态的编号');
		return false;
	}
	if(confirm('确定切换状态？')){
		$('form:eq(1)').attr('action','<?php echo spUrl('user','updst');?>').submit();
	}else{
		return false;
	}
}
</script>
</head>

<body>
<div class="gs_wraper gs_p_l0">
	<div class="tab_box">
		<table border="0" cellspacing="0" cellpadding="0" class="table_btm">
			<tr>
				<form action="<?php echo spUrl('user','lis');?>" method="post">
				<td>
					<label class="txt_s_blue">会员分组：</label><select name="search[groupid]" class="blue_input input_w_150">
					<option></option>
					<?php foreach($ucat as $row){?>
						<option value="<?php echo $row['id'];?>" <?php if($row['id']==$search['groupid']){?>selected="selected"<?php }?>><?php echo $row['ucatname'];?></option>
					<?php }?>
					</select>
					<label class="txt_s_blue">会员账号：</label><input name="search[usercode]" value="<?php echo $search['usercode'];?>" type="text" class="blue_input input_w_150" />
				</td>
				</form>
				<td><a href="javascript:;" onclick="$('form:eq(0)').submit()" class="btn_select">查 询</a></td>
			</tr>
		</table>
		<table width="100%" style="margin-top:10px;" border="0" cellpadding="0" cellspacing="0"  class="common_table">
			<tr>
				<th width="40"><input type="checkbox" onclick="$('.all_check').attr('checked',$(this).attr('checked'))" class="all_check" /><label>编号</label></th>
				<th width="100">会员账号</th><th width="100">会员姓名</th><th width="100">所属分组</th><th width="40">账户积分</th><th width="40">消费金额</th><th width="40">状态</th><th width="100">添加时间</th><th width="70">会员管理</th>
			</tr>
			<form action="" method="post">
			<?php foreach($user as $row){?>
			<tr>
				<td><input name="id[]" type="checkbox" value="<?php echo $row['id'];?>" class="all_check" /><label><?php echo $row['id'];?></label></td>
				<td><?php echo $row['usercode'];?></td><td><?php echo $row['username'];?></td><td><?php echo $row['ucat']['ucatname'];?></td><td><?php echo $row['jifen'];?></td><td><?php echo sprintf('%.2f',$row['money']);?></td>
				<td width="40"><?php if($row['status']==1){?>正常<?php }else{?><span style="color:red;">禁用</span><?php }?></td><td><?php echo date('Y-m-d H:i:s', $row['time']);?></td>
				<td><a href="<?php echo spUrl('user','upd',array('id'=>$row['id']));?>">[编辑]</a><a href="<?php echo spUrl('user','del',array('id'=>$row['id']));?>" onclick="return confirm('确定删除？');">[删除]</a></td>
			</tr>
			<?php }?>
			</form>
			<tr class="bottom">
				<td colspan="2" align="left" valign="middle">
					<a href="javascript:;" onclick="updst();" class="btn_wei f_left">切换状态</a>
				</td>
				<td colspan="7" align="right" valign="middle">
				<?php if($pager){?>
					<a href="javascript:;" onclick="location.href=('<?php echo spUrl('user','lis',array('groupid'=>$search['groupid'],'usercode'=>urlencode($search['usercode'])));?>&page='+(document.getElementById('gopage').value > <?php echo $pager['total_page'];?> ? <?php echo $pager['total_page'];?> : document.getElementById('gopage').value))" class="btn_jump f_right m_t_3">跳转</a>
					<span class="txt_color">每页<?php echo $pager['page_size'];?>条/共<?php echo $pager['total_count'];?>条记录</span>
					<span class="txt_color">当前<?php echo $pager['current_page'];?>/<?php echo $pager['total_page'];?>页</span>
					<?php if($pager['current_page']!=$pager['first_page']){?><a href="<?php echo spUrl('user','lis',array('page'=>$pager['first_page'],'groupid'=>$search['groupid'],'usercode'=>urlencode($search['usercode'])));?>">首页</a><?php }else{?><a href="javascript:;">首页</a><?php }?>
					<a href="<?php echo spUrl('user','lis',array('page'=>$pager['prev_page'],'groupid'=>$search['groupid'],'usercode'=>urlencode($search['usercode'])));?>">上一页</a>
					<a href="<?php echo spUrl('user','lis',array('page'=>$pager['next_page'],'groupid'=>$search['groupid'],'usercode'=>urlencode($search['usercode'])));?>">下一页</a>
					<?php if($pager['current_page']!=$pager['last_page']){?><a href="<?php echo spUrl('user','lis',array('page'=>$pager['last_page'],'groupid'=>$search['groupid'],'usercode'=>urlencode($search['usercode'])));?>">末页</a><?php }else{?><a href="javascript:;">末页</a><?php }?>
					<label>第</label><input type="text" class="page_input" id="gopage" size="3" value="<?php echo $pager['current_page'];?>" /><label>页</label>
				<?php }?>
				</td>
			</tr>
  		</table>
	</div>
</div>
</body>
</html>